package com.yeyks.common.em;

/**
 * @Author fuchangshuai
 * @date 2019/4/1 2:02 PM
 */
public enum OrderStatusEnum {
    //1待支付，2待入住，3已完成，4支付失败，5待退款，6已退款，7入住中，8已取消，9已评论，0已删除
    PREPAY(1, "待支付"),
    PRECHECKIN(2, "待入住"),
    POSTCHECKOUT(3, "已完成"),
    PAYFAILED(4, "支付失败"),
    PREREFUND(5, "待退款"),
    POSTREFUND(6, "已退款"),
    LIVING(7, "入住中"),
    CANCLE(8, "已取消"),
    COMMENT(9, "已评论"),
    toBeConfirmed(10, "待确认"),
    DELETE(0, "已删除");

    int value;
    String desc;

    OrderStatusEnum(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public int getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }

    public Integer value() {
        return this.value;
    }

    public String desc() {
        return this.desc;
    }

    public static String getDesc(int value) {
        OrderStatusEnum[] orderStatusEnums = values();
        for (OrderStatusEnum orderStatusEnum : orderStatusEnums) {
            if (orderStatusEnum.value() == value) {
                return orderStatusEnum.desc();
            }
        }
        return null;
    }

    public static Integer getValue(String desc) {
        OrderStatusEnum[] orderStatusEnums = values();
        for (OrderStatusEnum orderStatusEnum : orderStatusEnums) {
            if (orderStatusEnum.desc().equals(desc)) {
                return orderStatusEnum.value();
            }
        }
        return null;
    }
}
